{% extends 'TopxiaWebBundle::layout.html.twig' %}

{% block title %}{{'重设密码'|trans}} - {{ parent() }}{% endblock %}
{% set script_controller = 'auth/password-reset' %}

{% block content %}
<div class="row row-6">
  <div class="col-md-6 col-md-offset-3 ptl">
    <div class="panel panel-default panel-page">
      <div class="panel-heading"><h2>{{'重设密码'|trans}}</h2></div>

        <ul class="nav nav-tabs mbl js-find-password">
          <li class="active js-find-by-email">
            <a style="cursor: pointer;">{{'邮箱地址'|trans}}
            </a>
          </li>
          {% if (setting('cloud_sms.sms_enabled')|default('')) == '1' %}
            <li class="js-find-by-mobile">
              <a style="cursor: pointer;">{{'手机号码'|trans}}
              </a>
            </li>
          {% endif %}
        </ul>

      {% if error %} <div id="alertxx" class="alert alert-danger">{{ error }}</div> {% endif %}

      <form id="password-reset-form" class="form-vertical" method="post">
        <div class="form-group">
          {{ form_label(form.email, '邮箱地址'|trans, {label_attr:{class:'control-label'}}) }}
          <div class="controls">
            {{ form_widget(form.email, {attr:{class:'form-control'}}) }}
            <p class="help-block">请输入你在{{ setting('site.name') }}注册时填写的邮箱地址</p>
          </div>
        </div>

        <div class="form-group">
          <div class="controls">
            {{ form_rest(form) }}
            <button type="submit" class="btn btn-primary" data-loading-text="{{'正在发送重设密码邮件'|trans}}...">{{'重设密码'|trans}}</button>
          </div>
        </div>

        <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">

      </form>


      <form id="password-reset-by-mobile-form" class="form-vertical" action="{{ path('password_reset_by_sms') }}" method="post" style="display: none;">
        {# <div class="form-group">
          <label class="control-label required" for="nickname">用户名</label>
          <div class="controls">
            <input type="text" id="nickname" name="nickname"  class="form-control" data-role="nickname">
          </div>
        </div> #}

        <div class="form-group">
          <label class="control-label required" for="mobile">手机号码</label>
          <div class="controls">
            <input type="text" id="mobile" name="mobile" data-url="{{path('password_reset_check_mobile')}}" class="form-control" data-role="mobile">
          </div>
        </div>

        <div class="form-group">
          <label class="control-label required" for="sms_code">短信验证码</label>
          <div class="controls row" >
            <div class = "col-md-8" >
              <input type="text" class="form-control" id="sms-code" name="sms_code" data-explain="输入短信验证码" required="required" data-url="{{path('edu_cloud_sms_check',{type:'sms_forget_password'})}}">
            </div>

            <div class="col-md-4">
              <a href="#modal" data-toggle="modal" class="btn btn-default btn-sm js-sms-send disabled" data-url="{{ path('register_captcha_modal') }}" data-sms-url="{{ path('edu_cloud_sms_send') }}">
                <span id="js-time-left"></span>
                <span id="js-fetch-btn-text">获取短信验证码</span>
             </a>
            </div>

            <div class="col-md-12 help-block"></div>
          </div>
        </div>



        <div class="form-group">
          <div class="controls">
            <button type="submit" class="btn btn-primary" data-loading-text="提交中...">重设密码</button>
          </div>
        </div>

        <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
      </form>

    </div><!-- /panel -->

  </div>

</div>
{% endblock %}